			
			
			 <script language="javascript"> 
		function checkForm() 
		{ 
			var text = tinyMCE.getContent("txtContent");
			document.getElementById("tinyMCE").value = text;
			if ((document.getElementById('txtTitle').value == "")) 
			{ 
				  alert("Bạn cần nhập tieu de, chuyen muc va noi dung!"); 
				  return false; 
			} 
			return true; 
		} 
 </script>
	 
 <script language="javascript" >
	 function getcontent()
	 {
	    var content = tinyMCE.editors["txtContent"].getContents();
   window.opener.document.getElementById("txtArea").value = content;
   window.opener.save();
	}
	 </script>
	 
    

	 <script language="javascript" >
	 function toggle(div_id) {
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
function blanket_size(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	//popUpDiv_height=blanket_height/2-150;
	popUpDiv.style.top = 50 + 'px'; //popUpDiv_height + 'px';
}
function window_pos(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	//window_width=window_width/2-150;
	popUpDiv.style.left = 400 + 'px'; // window_width + 'px';
}
function popup(windowname) {


	blanket_size(windowname);
	window_pos(windowname);
	toggle('blanket');
	toggle(windowname);		
}
	</script>
</head>

<body>
			<!--Form viết bài -->
		 <form name="adminForm" enctype="multipart/form-data" method="post"
		       action="<?php echo $this->url(array('controller'=>'news','action'=>'index'));?>" >
				 
		 <input type="hidden" name="MAX_FILE_SIZE" value="500000" />  	<!--dung luong anh tieu de -->
		 <table>
			 <tr>
			 <td>Ngày Viết</td>
					<td nowrap="nowrap" id="retLabelSec" class="nextColumnAlignAndBold" style="visibility: visible;">	
					<input id="ngayve" name="ngayve" type="text">
					</td>
					<script>
						$( "#ngayve" ).datepicker();
					</script>
					<td id="retInputSec" style="visibility: visible;">
				
				
				
				
			  </tr>
			  <td>&nbsp;</td>
			  <tr>
			    <td >Tiêu đề</td>
			    <td width="524"><input type="text" name="txtTitle" id="txtTitle" width="700px" /></td>
			  </tr>
			  <td>&nbsp;</td>
			  <tr>
			    <td>Chuyên mục</td>
			    <td>
				 <select name="cbCategory">
				     <option value="" selected >--Chọn chuyên mục--</option>
					  <?php 
					  foreach($this->categories as $cate) 
					 {  
					  echo "<option value=".$this->escape($cate->CategoryId);
					  echo ">".$this->escape($cate->CategoryName)."</option>";
					  }
					  ?>
			    </select>
			    </td>
			  </tr>
			  <td>&nbsp;</td>
			  <tr>
			    <td>Ảnh đại diện</td>
			    <td><img name="txtImage" id="txtImage" height="100" width="100" src="<?php echo BASE_URL. 'images/NOpic.jpg'; ?>"/></td>
			  </tr>
			  <tr>
			    <td height="35">Tên ảnh</td>
			    <td>
			    <input name="btBrowse" type="file" id="btBrowse" width="500" value="Chọn ảnh" onClick ="return alert(this.value);" /></td>
			  </tr>
			  
			  <tr>
			    <td>Nội dung</td>
			    
			<td><textarea name="txtContent" id="elm4" cols="80" rows="15" style="width: 80%"></textarea></td>
			  </tr>
			  <tr>
			    <td>&nbsp;</td>
				 
				  <td>
				     
				     <input name="btReset" type="button" id="btReset" value="Reset" onClick="return checkForm();" />
				     <div class="aerobuttonmenu black" >
					       <a name="btSave" id="btSave" onclick="checkForm();"
			 				    href="javascript:document.adminForm.submit();" class="aero"><span>Lưu bài viết</span></a> 
								 
					  </div>
				 </td>
			    

			  </tr>
		</table>
		
		
		</form>
		
</body>